/*-----全屏事件------*/
var screen = {
    setFullScreen: function () {
        var element = document.getElementsByTagName("body")[0];
        var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen ||
element.mozRequestFullScreen || element.msRequestFullScreen;
        if (requestMethod) {
            requestMethod.call(element);
        } else if (typeof window.ActiveXObject !== "undefined") {
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript !== null) {
                wscript.SendKeys("{F11}");
            }
        }
    },
    exitFullScreen: function () {
        var el = document;
        var cfs = el.cancelFullScreen || el.webkitCancelFullScreen ||
  	      el.mozCancelFullScreen || el.exitFullScreen;
        if (typeof cfs != "undefined" && cfs) {
            cfs.call(el);
        } else if (typeof window.ActiveXObject != "undefined") {
            //for IE，这里和fullScreen相同，模拟按下F11键退出全屏
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript != null) {
                wscript.SendKeys("{F11}");
            }
        }
    },
    init: function () {
        //全屏
        $("#fullpage").click(function () {
            page.initialStatus("fullPage");
            if ($(this).hasClass("isFull")) {
                $(this).find("p").html("全屏");
                //退出全屏
                screen.exitFullScreen();
                $(this).parents("#switch-box").find(".bar-item").removeClass("active");
                $(this).removeClass("isFull");
            } else {
                $(this).parents("#switch-box").find(".bar-item").removeClass("active");
                $(this).find("p").html("取消<br>全屏");
                $(this).addClass("active");
                //设置全屏
                screen.setFullScreen();
                $(this).addClass("isFull");
            }
        });
        //esc键盘事件
        $(document).keyup(function (e) {
            if (e.keyCode == 27) {
                $("#fullpage").removeClass("active").removeClass("isFull")
            }
        });
    }
}